

#import <Foundation/Foundation.h>
#import "AFNetworking/AFNetworking.h"
#import "APImageModel.h"
#import "APOSSPolicyModel.h"
typedef NS_ENUM(NSInteger, DMNetWorkStatus) {
    DMNetWorkStatusUnknown          = -1,//未知
    DMNetWorkStatusNotReachable     = 0,//没有网络
    DMNetWorkStatusReachableViaWWAN = 1,//流量
    DMNetWorkStatusReachableViaWiFi = 2,//wifi
};


typedef void (^DMNetworkReachabilityStatusBlock)(DMNetWorkStatus status);
typedef void(^dmRequestFailBlock)(NSString *_Nullable msg);

@interface APDataManager : NSObject
/**检测网路状态**/
+ (DMNetWorkStatus)netWorkStatusChanged:(DMNetworkReachabilityStatusBlock _Nullable)notWorkStatus;
/**
 *@description post 请求
 *表单提交
 */
+ (void)requestData:(NSString *_Nullable)urlString
         parameters:(NSDictionary *_Nullable)parameters
             result:(void (^_Nullable)(NSDictionary *_Nullable res))result
          failBlock:(void (^_Nullable)(NSString *_Nullable errorMsg))failBlock;

+ (void)postWithUrlString:(NSString *_Nullable )urlString
               parameters:(NSDictionary *_Nullable )parameters
                   result:(void (^_Nullable)(NSDictionary *_Nullable res))result
                failBlock:(void (^_Nullable)(NSString *_Nullable errorMsg))failBlock;
+ (void)requestOriginalData:(NSString *_Nullable )urlString
                 parameters:(NSDictionary *_Nullable )parameters
                     result:(void (^_Nullable)(id _Nullable responseObject))result
                  failBlock:(void (^_Nullable)(NSString *_Nullable errorMessage))failBlock;
/**
 *@description post 请求
 *参数json提交（application/json）
 */
+ (void)postJsonWithUrlString:(NSString *_Nullable )urlString
              timeoutInterval:(NSTimeInterval)timeout
                   parameters:(id )parameters
                       result:(void (^_Nullable)(NSDictionary *_Nullable res))result
                    failBlock:(void (^_Nullable)(NSString *_Nullable errorMsg))failBlock;
/**
 *@description get
 */
+ (void)getDataWithUrlString:(NSString *_Nullable )urlString
                      result:(void (^_Nullable)(NSDictionary *_Nullable res))result
                   failBlock:(void (^_Nullable)(NSString *_Nullable errorMsg))failBlock;
/**
 *@description get
 */
+ (void)getDataNoProcessWithUrlString:(NSString *_Nullable )urlString
                           jsonObject:(void (^_Nullable )(NSDictionary *_Nullable jsonDict))result
                                 fail:(void (^_Nullable)(NSError *_Nullable error))fail;

+ (void)uploadImagesWithUrl:(NSString *_Nullable)url  policy:(APOSSPolicyModel *_Nullable)ossModel image:(UIImage *_Nullable)image progress:(void (^_Nullable)(NSProgress * _Nonnull))progress resultBlock:(void (^_Nullable)(NSString * _Nonnull))resultBlock failBlock:(void (^_Nullable)(NSString * _Nonnull))failBlock;


+ (void)uploadImagesWithUrl:(NSString *_Nullable)url  policy:(APOSSPolicyModel *_Nullable)ossModel imageUrl:(NSString *_Nullable)urlString progress:(void (^_Nullable)(NSProgress * _Nonnull))progress resultBlock:(void (^_Nullable)(NSArray<APImageModel *> * _Nonnull))resultBlock failBlock:(void (^_Nullable)(NSString * _Nonnull))failBlock;

/**
 *@description 业务请求结果
 */
+ (BOOL)isRequestSuccess:(NSDictionary *_Nullable)responseObject;
/**
 *@description 自定义添加 http header
 */
+ (void)addHttpHeaderFields:(AFHTTPSessionManager *_Nullable)manager;
@end
